package com.sneakxy.cloudbase.platform.handler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;

import com.sneakxy.cloudbase.platform.utils.web.RequestMappingHandler;

public class CloudBaseRequestMappingHandlerMapping extends RequestMappingHandlerMapping {

	@Autowired(required=false)
	private RequestMappingHandler[] handlers;
	
	@Override
	protected boolean isHandler(Class<?> beanType) {
		return super.isHandler(beanType) && isExtraHandler(beanType);
	}

	protected boolean isExtraHandler(Class<?> beanType) {
		boolean result = true;
		if(handlers != null) {
			for(RequestMappingHandler handler: handlers) {
				result = handler.isHandler(beanType) && result;
			}
		}
		return result;
	}
	
}
